package cn.woniu.ecommerceplatform.controller;

import cn.woniu.ecommerceplatform.entity.Orders;
import cn.woniu.ecommerceplatform.entity.Services;
import cn.woniu.ecommerceplatform.mapper.ServicesMapper;
import cn.woniu.ecommerceplatform.service.ServicesService;
import cn.woniu.ecommerceplatform.util.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/services")
public class ServicesController {

    @Autowired(required = false)
    private ServicesService servicesService;

    @RequestMapping("servicesList")
    public ResponseResult<?> servicesList(String goodName, String orderNum, Integer status, String account, Integer pageNum, Integer pageSize){
        return servicesService.servicesList(goodName, orderNum, status, account, pageNum, pageSize);
    }

    @RequestMapping("servicesDelete")
    public ResponseResult<?> servicesDelete( Integer id){
        return servicesService.servicesDelete(id);
    }

    @RequestMapping("servicesDetails")
    public ResponseResult<?> servicesDetails(Integer serviceId){
        return servicesService.servicesDetails(serviceId);
    }

    @PostMapping("serviceUpdate")
    public ResponseResult<?> serviceUpdate(@RequestBody Services sales){
        return servicesService.serviceUpdate(sales);
    }

    @PostMapping("servicesDetailsUpdate")
    public ResponseResult<?> servicesDetailsUpdate(@RequestBody Services sales){
        return servicesService.servicesDetailsUpdate(sales);
    }

    @RequestMapping("userServicesDelete")
    public ResponseResult<?> userServicesDelete(Integer serviceId){
        return servicesService.userServicesDelete(serviceId);
    }

    @PostMapping("servicesAdd")
    public ResponseResult<?> servicesAdd(@RequestBody Services sales){
        return servicesService.servicesAdd(sales);
    }

    @RequestMapping("queryServicesByOrderId")
    public ResponseResult<?> queryServicesByOrderId(Integer orderId){
        return servicesService.queryServicesByOrderId(orderId);
    }

    @PostMapping("serviceDealAdd")
    public ResponseResult<?> serviceDealAdd(@RequestBody Services sales){
        return servicesService.serviceDealAdd(sales);
    }

    @PostMapping("serviceUpdateByOrderId")
    public ResponseResult<?> serviceUpdateByOrderId(@RequestBody Services sales){
        return servicesService.serviceUpdateByOrderId(sales);
    }
}
